package com.ambimmort.ucagent.utils;

import java.util.Calendar;

/**
 * Created by hedingwei on 2015/1/17.
 */
public class IdUtils {

    public static long getId(Object obj){
        Calendar c = Calendar.getInstance();
        c.set(c.get(Calendar.YEAR),0,1,0,0,0);
        int idpart1 = obj.hashCode();
        int idpart2 = c.get(Calendar.YEAR);
        int idpart3 =(int)((System.currentTimeMillis()-c.getTimeInMillis())/(1000*60*60*24));
        int idpart5 = 10+ (int)(Math.random()*89);
        String p1 = idpart1+""+idpart2+""+idpart3+""+idpart5;
        return Long.parseLong(p1);
    }

}
